package com.yjweb.webportal.service;

import com.github.pagehelper.PageHelper;
import com.yjweb.webportal.entities.Employee;
import com.yjweb.webportal.entities.Pagination;
import com.yjweb.webportal.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by windMan on 2018/6/8
 */
@Service
public class EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    //查询分页
    public  Pagination<Employee> getAllEmpInfopublic(int page,int size) {
        PageHelper.startPage(page,size);
       return new Pagination<Employee>(employeeMapper.getAllEmpInfo());
    }
    //插入单条数据
    public void insertEmp(Employee employee){
        employeeMapper.insertEmp(employee);
    }
    //根据id获取数据
    public Employee getEmpById(Integer id){
       return employeeMapper.getEmpById(id);
    }

    //根据id修改数据
    public void updateEmp(Employee employee){
        employeeMapper.updateEmp(employee);
    }
    //根据id修改数据
    public void deleteEmp(Integer id){
        employeeMapper.deleteEmp(id);
    }
}
